Fix problem with echo-keystrokes and minibuffer
authorjustbur <justin@burkett.cc>
Mon, 6 Jul 2015 14:54:24 +0000 (10:54 -0400)
committerjustbur <justin@burkett.cc>
Mon, 6 Jul 2015 14:54:24 +0000 (10:54 -0400)
If the echo-keystrokes delay is too long, it clobbers which-key in the
minibuffer

which-key.el

index 97393af9c0b93e2269a23312245d5597a5071b4d..37a6e234496395bd256d7640364394c396c6fb71 100644 (file)
@@ -69,6 +69,8 @@ location is top or bottom.")
 (defvar which-key--frame nil
   "Internal: Holds reference to which-key frame.
 Used when `which-key-popup-type' is frame.")
+(defvar which-key--echo-keystrokes-backup echo-keystrokes
+  "Internal: Backup the initial value of echo-keystrokes.")
 
 ;;;###autoload
 (define-minor-mode which-key-mode
@@ -78,9 +80,13 @@ Used when `which-key-popup-type' is frame.")
   (if which-key-mode
       (progn
         (unless which-key--setup-p (which-key/setup))
+        ;; turn off echo-keytrokes for minibuffer (it can interfer)
+        (when (eq which-key-popup-type 'minibuffer) (setq echo-keystrokes 0))
         (add-hook 'focus-out-hook 'which-key/stop-open-timer)
         (add-hook 'focus-in-hook 'which-key/start-open-timer)
         (which-key/start-open-timer))
+    ;; make sure echo-keystrokes returns to original value
+    (setq echo-keystrokes which-key--echo-keystrokes-backup)
     (remove-hook 'focus-out-hook 'which-key/stop-open-timer)
     (remove-hook 'focus-in-hook 'which-key/start-open-timer)
     (which-key/stop-open-timer)